package WaiBao;

import java.util.Arrays;

public class ZhangMengYue {
    public static void main(String[] args) {
        String[] name = {"冯菲(班长)","伍贵才(团支书)", "小李(学习委员)","张巧(文艺委员)", "范英", "王军", "杨先敏", "周丽", "杨宁", "杜海鸥", "赵珊", "卓冬梅",
                "郭丽梅", "白辉", "王晓蓉", "黄乐清", "龙一", "邓艳", "百昌润", "赵泽国", "吕丫", "蒋小燕", "谭雄鹰", "包厉", "毕顺兰", "陈飞", "陈敏", "蔡李荣",
                "西施", "张梦岳(学生)"};//考生本人: 张梦岳(学生)
        int[] age = {20, 18, 18, 17, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 20};//最后一位：考生年龄:20
//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }

        double[] SOUT1 = {78, 72, 96, 84, 77, 79, 78, 89, 81, 90, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 95};
        double[] SOUT2 = {77, 75, 78, 86, 68, 87, 88, 79, 70, 90, 90, 77, 66, 85, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 94};
        double[] SOUT3 = {62, 69, 64, 95, 88, 89, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};

        double apple ;//代表每个学生的总分
        double banana;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            apple = SOUT1[i] + SOUT2[i] + SOUT3[i];
//            banana = ( apple * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  apple);
//            System.out.println(name[i] + "的平均分为:" +banana);
//        }


        double oracle = 0,berry = 0;
        double[] lemon  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            oracle = SOUT1[i] + SOUT2[i] + SOUT3[i];
//            berry = (oracle * 1.0) / 3;
//            lemon  [i] =berry ;
//        }
//
//        for (int i = 0; i <  lemon  .length - 1; i++) {
//            for (int j = 0; j <  lemon .length - i - 1; j++) {
//                if (lemon  [j] < lemon [j + 1]) {
//                    double tep =  lemon  [j];
//                    lemon [j] = lemon[j + 1];
//                    lemon [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( lemon [i]);
//        }




        double mango1 = 0, mango2 = 0,mango3 = 0;//计算每门课的平均分
        double peach1 = 0, peach2 = 0, peach3 = 0;//计算每门课标准差
        double  strawberry1 = 0, strawberry2 = 0,  strawberry3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <SOUT1.length; i++) {
            he += SOUT1[i];
        }
        mango1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" +mango1);
        double Sum = 0;
        for (int i = 0; i < SOUT2.length; i++) {
            Sum +=SOUT2[i];
        }
        mango2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + mango2);
        double sum = 0;
        for (int i = 0; i < SOUT3.length; i++) {
            sum +=SOUT3[i];
        }
        mango3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + mango3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <SOUT1.length; i++) {
            c1 += (SOUT1[i] - mango1) * (SOUT1[i] - mango1);
        }
        peach1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" +  peach1);
        for (int i = 0; i < SOUT2.length; i++) {
            c2 += (SOUT2[i] - mango2) * (SOUT2[i] -mango2);
        }
        peach2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" + peach2);

        for (int i = 0; i <SOUT3.length; i++) {
            c3 += (SOUT3[i] - mango3) * (SOUT3[i] - mango3);
        }
        peach3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" +  peach3);
////
////
//        Arrays.sort(SOUT1);
//        Arrays.sort(SOUT2);
//        Arrays.sort(SOUT3);
//        strawberry1 = (SOUT1[15] + SOUT1[14]) * 1.0 / 2;
//        strawberry2 = (SOUT2[15] +SOUT2[14]) * 1.0 / 2;
//        strawberry3 = (SOUT3[15] + SOUT3[14]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +   strawberry1);
//        System.out.println("农业设施设计与制造的中位数为:" +   strawberry2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +   strawberry3);
    }
}
